﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FTI
{
    public static partial class Extensions
    {
        public static T[] Each<T>(this T[] array, Func<T, T> each)
        {
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = each(array[i]);
            }

            return array;
        }

        public static T[] Add<T>(this T[] array, T element)
        {
            T[] @new = new T[] { element };

            if (array == null || array.Length == 0)
                return @new;
            else
                return array.Concat(@new).ToArray();
        }
    }
}
